home *** CD-ROM | disk | FTP | other *** search
- Path: qualcomm.com!usenet
- From: nabbasi@qualcomm.com (Nasser Abbasi)
- Newsgroups: comp.lang.c++
- Subject: Re: Possible VC 4.0 bug?
- Date: 1 Feb 1996 01:06:49 GMT
- Organization: QUALCOMM
- Message-ID: <4ep3n9$a31@qualcomm.com>
- References: <4eor3o$d06@enterprise.turningpoint.com>
- NNTP-Posting-Host: nabbasi.qualcomm.com
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.14
-
- In article <4eor3o$d06@enterprise.turningpoint.com>, sathan@cybercom.net
- says...
- >
- >When I compile and run the following code under MSVC 4.0, I get an
- access
- >violation on the delete:
- >
- >------------------------------------------------------------------------
- -
- >
- >#include <stdio.h>
- >
- >class foo
- > {
- > public :
- > virtual ~foo( );
- > };
- >
- >foo::~foo( )
- > {
- > printf( "In foo::~foo.\n" );
- > }
- >
- >int main( )
- > {
- > foo* p = new foo[ 0 ];
- >
- > delete [] p;
- >
- > return 0;
- > }
- >
- >------------------------------------------------------------------------
- --
- >
- >Everything works fine, and the destructor is never called, if the
- destructor
- >is not virtual.
- >
- >Is this a problem with VC, or with my understanding of how a new of size
- zero
- >should work? Thanks.
- >
-
-
- Did the above actually compile? you are trying to allocate array of size
- zero? that should not work outside a class members ?
-
- Nasser
-
-
-